#ifndef MYTEST_H
#define MYTEST_H

#include <QObject>
#include "transfersocket.h"
#include "tcpmanager.h"
#include "filemanager.h"
#include "FileBlock.h"

class MyTest : public QObject
{
    Q_OBJECT
public:
    MyTest(QObject *parent = nullptr);
    ~MyTest();

    /**
     * @brief   : 回调函数，被TcpManager使用
     * @param   : magic 标识
     * @param   : header 文件描述信息
     * @param   : data   文件数据信息
     * @author  : BinWatson
     * @version : v1.0
     * @date    : 2022-06-22 09:38:31
     */
    Q_INVOKABLE void onRecvNewFile(qint64 magic, QByteArray header);
    Q_INVOKABLE void onNewFileBody(qint64 magic, QByteArray data);

public slots:

    void onSendFileComplete(QSharedPointer<QFile> file);
    void onNewConnection(QSharedPointer<TransferSocket> socket);

private:
    bool runInLoop() const;

private:
    QThread *m_thread;
};

#endif // MYTEST_H
